#ifndef ROWNODE_H
#define ROWNODE_H

#include "Row.h"
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>

using namespace std;

#define MAXLENGTH 512

class RowNode 
{
private:
	bool isnull;
	bool isblockhead;
	bool isblocktail;
	int blockhead;
	int blocktail;
	class RowNode* prev;
	class RowNode* next;
	class Row* row;
public:
	RowNode( RowNode *p );
	RowNode();
	~RowNode();
	inline bool isNull() { return isnull; }
	inline bool isBlockHead() { return isblockhead; }
	inline bool isBlockTail() { return isblocktail; }
	inline int GetBlockHead() { return blockhead; }
	inline int GetBlockTail() { return blocktail; }
	inline class RowNode* NextNode() { return this->next; }
	inline class RowNode* PrevNode() { return this->prev; }
	inline class Row* PointRow() { return this->row; }
	inline void SetRow(class Row& p) { this->row = p; }
};

RowNode:: RowNode( class RowNode *p ) {
	isnull = 1;
	isblockhead = 0;
	isblocktail = 0;
	blockhead = 0;
	blocktail = 0;
	if(p->next == NULL)
	{
		this->next = NULL;
		this->prev = p;
		p->next = this;
	}
	else
	{
		this->next = p->next;
		this->prev = p;
		p->next = this;
	}
	row = NULL;
}

RowNode:: RowNode() {
	isnull = 1;
	isblockhead = 0;
	isblocktail = 0;
	blockhead = 0;
	blocktail = 0;
	this->prev = NULL;
	this->next = NULL;
	row = NULL;
}

#endif